package com.moon.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author ：xxx
 * @description：TODO
 * @date ：2024/05/30 17:39
 */
@Component
@Slf4j
public class CommandLineRunnerConfig {

    @Bean
    @Order(1)
    public ApplicationRunner runner1() {
        return (args) -> {
//            Thread.sleep(20000);
            log.info(Thread.currentThread().getName() + "----ApplicationRunner-----");
        };
    }



    @Bean
    @Order(2)
    public CommandLineRunner runner2() {
        return (args) -> {
//            while(true){
//                Thread.sleep(30000);
                log.info(Thread.currentThread().getName() + "----CommandLineRunner----------");
//            }
        };
    }
}
